# file:: action.rb
# author::  Ralph M. Churchill
# version::
# date::
#
# This source code copyright (C) 2006 by Ralph M. Churchill
# All rights reserved.
#
# Released under the terms of the GNU General Public License
# See LICENSE file for additional information.

require 'models/entity'
require 'models/container'

class Action
    include BelongsToEntity
    properties :type, :data

    # [+type+] Symbol identifying the action
    # [+performer+] Entity performing the action
    # [+data+] A free-form hash containing information about the action
    def initialize(type,performer,data={})
        self.type = type
        self.owner = performer
        self.data = data
    end
    # Alias for owner
    def performer
        self.owner
    end
    def to_s
        "\n\tPerformer: #{self.performer} \n\tAction: #{self.type} \n\tData: {" + 
        self.data.collect{|k,v| ":#{k}=>#{v.to_s.sub(TelnetCommands::EOL,'')}"}.join(', ') +
        "}"
    end
end
